<?php
	require 'include.php';
	$id = (!empty($_REQUEST['id'])) ? $_REQUEST['id'] : "";
	if(empty($id)){
		echo "<h2>Les infos</h2>\n";
		$q = "select infos.id as id,infos.titre as titre, datetime, concat(prenom,' ',nom) as auteur from infos left join membres on (membre_id = membres.id) where infos.valide = 1  and curdate() < date_add(datetime, interval 90 day) order by datetime desc";
		$r = ExecRequete($q);
		while($s = LigneSuivante($r)){
			echo "<div class = 'separation' onclick = 'infos($s->id)'>\n";
			echo "<p ><span class = 'bold'>$s->titre</span><br />\n";
			echo "[".format_date($s->datetime,"d.m.Y")."] $s->auteur";
			echo "</div>\n";
		}		
	}
	else{
		$info = new info($id);
		echo "<h2>$info->titre</h2>\n";
		$auteur = new membre($info->membre_id);
		echo "<p class = 'center fade'>$auteur->prenom $auteur->nom, ".format_date($info->datetime,'d.m.Y')."</p>\n";
		echo "<p class = 'justify'>".(prepare_info($info->corps))."</p>";
		if($echo = $info->list_commentaires()){
			echo "<div class = 'separation'>\n";
			echo $echo;
			echo "</div>\n";			
		}
	}
	
	
?>